From 0eadfdeb17f6bcdc752e726aa5859d6cf32670d2 Mon Sep 17 00:00:00 2001 From: rlot Date: Mon, 2 Jan 2017 14:48:31 +0100 Subject: [PATCH] Fully deprecate 'ContentAction' hook Bug: T54027 Change-Id: Ia765e25a9f76b34f7b10125d3b6e0c8e00fac2ca --- RELEASE-NOTES-1.29 | 2 ++ docs/hooks.txt | 5 +++-- includes/MediaWiki.php | 11 +++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES-1.29 b/RELEASE-NOTES-1.29 index 14b569282c..f2d738aae8 100644 --- a/RELEASE-NOTES-1.29 +++ b/RELEASE-NOTES-1.29 @@ -152,6 +152,8 @@ changes to languages because of Phabricator reports. * Class ImageGallery (deprecated in 1.22) was removed. Use ImageGalleryBase::factory instead. * Title::moveNoAuth() (deprecated in 1.25) was removed. Use MovePage class instead. +* Hook UnknownAction (deprecated in 1.19) was actually deprecated (it will now emit warnings). + Create a subclass of Action, and add it to $wgActions instead. == Compatibility == diff --git a/docs/hooks.txt b/docs/hooks.txt index e8335cd5a7..2f99fffdb0 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -3420,8 +3420,9 @@ Since 1.24: Paths pointing to a directory will be recursively scanned for test case files matching the suffix "Test.php". &$paths: list of test cases and directories to search. -'UnknownAction': An unknown "action" has occurred (useful for defining your own -actions). +'UnknownAction': DEPRECATED! To add an action in an extension, +create a subclass of Action, and add a new key to $wgActions. +An unknown "action" has occurred (useful for defining your own actions). $action: action name $article: article "acted on" diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php index eaa1c99539..faca533618 100644 --- a/includes/MediaWiki.php +++ b/includes/MediaWiki.php @@ -495,8 +495,15 @@ class MediaWiki { $action->show(); return; } - - if ( Hooks::run( 'UnknownAction', [ $request->getVal( 'action', 'view' ), $page ] ) ) { + // NOTE: deprecated hook. Add to $wgActions instead + if ( Hooks::run( + 'UnknownAction', + [ + $request->getVal( 'action', 'view' ), + $page + ], + '1.19' + ) ) { $output->setStatusCode( 404 ); $output->showErrorPage( 'nosuchaction', 'nosuchactiontext' ); } -- 2.20.1